<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  
  <title>Hexo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta property="og:type" content="website">
<meta property="og:title" content="Hexo">
<meta property="og:url" content="https://chenliwang.gitee.io/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="John Doe">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">
  
  
    <link rel="shortcut icon" href="/favicon.png">
  
  
    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typeface-source-code-pro@0.0.71/index.min.css">

  
  
<link rel="stylesheet" href="/css/style.css">

  
    
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">

  
<meta name="generator" content="Hexo 5.4.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Hexo</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://chenliwang.gitee.io"></form>
      </div>
    </div>
  </div>
</header>

      <div class="outer">
        <section id="main">
  
    <article id="post-Hexo" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/03/18/Hexo/" class="article-date">
  <time class="dt-published" datetime="2021-03-18T03:44:06.100Z" itemprop="datePublished">2021-03-18</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/03/18/Hexo/">Hexo进门</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <p>最近突发奇想的，想要快速的开发个人博客，但是又不想去像以前开发一样，把前端知识和后端结合，然后部署到服务器上。就想使用个前端或者后端的框架，快速开发，快速部署到云上。<br>哒哒哒，经过度娘、知乎和B站的各种查找，最后决定使用Hexo尝试一下。于是开始：</p>
<h2 id="Hexo的使用"><a href="#Hexo的使用" class="headerlink" title="Hexo的使用"></a>Hexo的使用</h2><p>必备良药：nodejs、npm(cnpm)、gitee(相对github要快，毕竟国内的)、主题（暂时默认，后面文章在使用其他主题）</p>
<h3 id="安装Nodejs"><a href="#安装Nodejs" class="headerlink" title="安装Nodejs"></a>安装Nodejs</h3><p>跑到<a target="_blank" rel="noopener" href="https://nodejs.org/en/">nodejs</a>的网站下载安装，直到安装完成</p>
<h3 id="验证安装"><a href="#验证安装" class="headerlink" title="验证安装"></a>验证安装</h3><p>命令：<code>node -v和npm -v</code><br><img src="https://img-blog.csdnimg.cn/20210318083439796.png#pic_center" alt="在这里插入图片描述"></p>
<h3 id="安装淘宝cnpm"><a href="#安装淘宝cnpm" class="headerlink" title="安装淘宝cnpm"></a>安装淘宝cnpm</h3><p>为了速度更快些，使用淘宝cnpm管理器<br>命令：<code>npm install -g cnpm --registry=http://registry.npm.taobao.org</code><br>安装完成查看cnpm是否成功，查看版本信息<code>cnpm -v</code><br><img src="https://img-blog.csdnimg.cn/20210318083959768.png#pic_center" alt="在这里插入图片描述"></p>
<h3 id="安装hexo框架"><a href="#安装hexo框架" class="headerlink" title="安装hexo框架"></a>安装hexo框架</h3><p>命令：<code>cnpm install -g hexo-cli</code><br>安装完成查看版本<code>hexo -v</code><br><img src="https://img-blog.csdnimg.cn/20210318084539398.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyMDE1NTY1,size_16,color_FFFFFF,t_70#pic_center" alt="在这里插入图片描述"></p>
<h3 id="使用Hexo创建博客"><a href="#使用Hexo创建博客" class="headerlink" title="使用Hexo创建博客"></a>使用Hexo创建博客</h3><ul>
<li><p>新建博客目录，在win上直接建就行，在Liunx上就mkdir一下<br><img src="https://img-blog.csdnimg.cn/20210318102715529.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyMDE1NTY1,size_16,color_FFFFFF,t_70#pic_center" alt="在这里插入图片描述"></p>
</li>
<li><p>进入博客目录，初始化博客<br>命令：<code>hexo init</code><br>可能报错：<br><img src="https://img-blog.csdnimg.cn/20210318102931760.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyMDE1NTY1,size_16,color_FFFFFF,t_70#pic_center" alt="在这里插入图片描述"><br>大意是连接到github的下载失败，这个多试一下或者在网上找一下解决方案就行</p>
</li>
<li><p>初始化好之后，查看目录test<br><img src="https://img-blog.csdnimg.cn/20210318104621917.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyMDE1NTY1,size_16,color_FFFFFF,t_70#pic_center" alt="在这里插入图片描述"><br><img src="https://img-blog.csdnimg.cn/20210318104713762.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyMDE1NTY1,size_16,color_FFFFFF,t_70#pic_center" alt="在这里插入图片描述"></p>
</li>
<li><p>初始化好之后，可以启动项目看看<br>命令：<code>hexo s</code>   具体的命令，可以自行查看官方文档<br><img src="https://img-blog.csdnimg.cn/20210318105111878.png#pic_center" alt="在这里插入图片描述"><br>访问运行成功的地址<a target="_blank" rel="noopener" href="http://localhost:4000/">http://localhost:4000</a><br><img src="https://img-blog.csdnimg.cn/20210318105151902.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyMDE1NTY1,size_16,color_FFFFFF,t_70#pic_center" alt="在这里插入图片描述"><br>到这里说明博客项目初始化已经成功</p>
</li>
<li><p>主要目录分析<br><img src="https://img-blog.csdnimg.cn/20210318110141822.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyMDE1NTY1,size_16,color_FFFFFF,t_70#pic_center" alt="在这里插入图片描述"><br>主要注意的就是图中的四个位置</p>
</li>
</ul>
<h3 id="Hexo主要使用分析"><a href="#Hexo主要使用分析" class="headerlink" title="Hexo主要使用分析"></a>Hexo主要使用分析</h3><ul>
<li><p><strong>source</strong>目录<br>主要存放各种博客文章，Markdown格式的。<br><img src="https://img-blog.csdnimg.cn/20210318110659106.png#pic_center" alt="在这里插入图片描述"></p>
</li>
<li><p><strong>themes</strong>目录<br>主要用来放各种主题，比如fluid,next等<br><img src="https://img-blog.csdnimg.cn/20210318111020759.png#pic_center" alt="在这里插入图片描述"><br>站点（这里指的是hexo）的默认主题（ui等）是landscape，后续文章会更换新的主题</p>
</li>
<li><p><strong>_config.yml</strong><br>这是站点的配置文件，进行各项配置用的<br>打开文件，主要使用的有文件最后的<strong>两处</strong>配置<br><img src="https://img-blog.csdnimg.cn/20210318112201504.png#pic_center" alt="在这里插入图片描述"><br>theme用于指定主题，deploy用于配置将要部署站点到哪的信息</p>
<h3 id="Hexo新建文章"><a href="#Hexo新建文章" class="headerlink" title="Hexo新建文章"></a>Hexo新建文章</h3><p>命令：<code>hexo new &quot;My New Post&quot;</code></p>
</li>
</ul>
<p> <img src="https://img-blog.csdnimg.cn/20210318112923529.png#pic_center" alt="在这里插入图片描述"><br><img src="https://img-blog.csdnimg.cn/20210318112941448.png#pic_center" alt="在这里插入图片描述"><br>可以看到已经创建新的文章</p>
<h3 id="Hexo重新部署"><a href="#Hexo重新部署" class="headerlink" title="Hexo重新部署"></a>Hexo重新部署</h3><p>记住几个命令：<br>项目有修改后，需要清理一下，命令：<code>hexo c</code><br>项目生成，命令：<code>hexo g</code><br>项目运行，命令：<code>hexo s</code><br>项目部署到远端，命令：<code>hexo d</code>这个后面文章会用<br>执行玩c,g,s后，刷新页面看看<br><img src="https://img-blog.csdnimg.cn/20210318113656272.png#pic_center" alt="在这里插入图片描述"><br><img src="https://img-blog.csdnimg.cn/202103181137159.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyMDE1NTY1,size_16,color_FFFFFF,t_70#pic_center" alt="在这里插入图片描述"><br>可以看到新的文章也显示出来了，但是因为新建文章后，没有进行Markdown的编辑，所以仅仅有title，具体的md编辑方法，网上都有很多了，这里主要注意的是，如果是将自己的md文档放到source的_posts下时，要编辑文档的头部格式</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://chenliwang.gitee.io/2021/03/18/Hexo/" data-id="ckmebx8ls0000kgs5dfeu8wqc" data-title="Hexo进门" class="article-share-link">Share</a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-my-first-blog" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/03/18/my-first-blog/" class="article-date">
  <time class="dt-published" datetime="2021-03-18T03:27:15.000Z" itemprop="datePublished">2021-03-18</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/03/18/my-first-blog/">my first blog</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        
      
    </div>
    <footer class="article-footer">
      <a data-url="https://chenliwang.gitee.io/2021/03/18/my-first-blog/" data-id="ckmebkbsw0000ags53s4b1qjc" data-title="my first blog" class="article-share-link">Share</a>
      
      
      
    </footer>
  </div>
  
</article>



  
    <article id="post-hello-world" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/03/18/hello-world/" class="article-date">
  <time class="dt-published" datetime="2021-03-18T02:42:19.331Z" itemprop="datePublished">2021-03-18</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="p-name article-title" href="/2021/03/18/hello-world/">Hello World</a>
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <p>Welcome to <a target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a target="_blank" rel="noopener" href="https://hexo.io/docs/">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a target="_blank" rel="noopener" href="https://hexo.io/docs/troubleshooting.html">troubleshooting</a> or you can ask me on <a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo/issues">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">&quot;My New Post&quot;</span></span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/writing.html">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/server.html">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/generating.html">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://chenliwang.gitee.io/2021/03/18/hello-world/" data-id="ckme9wxnu00006ws58bsbcj73" data-title="Hello World" class="article-share-link">Share</a>
      
      
      
    </footer>
  </div>
  
</article>



  


</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/03/">March 2021</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2021/03/18/Hexo/">Hexo进门</a>
          </li>
        
          <li>
            <a href="/2021/03/18/my-first-blog/">my first blog</a>
          </li>
        
          <li>
            <a href="/2021/03/18/hello-world/">Hello World</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      
      &copy; 2021 John Doe<br>
      Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    


<script src="/js/jquery-3.4.1.min.js"></script>



  
<script src="/fancybox/jquery.fancybox.min.js"></script>




<script src="/js/script.js"></script>





  </div>
</body>
</html>